Object-oriented programming is rapidly becoming the software industry's preferred method for developing software. Essentially, object orientation is a method of implementing components of a system and of constructing systems from these components.
"Objects" are software entities comprising data structures and associated operations. Objects can model concrete things or abstract ideas, in terms of characteristics or in terms of behavior. A software "object" is a group of elements working together or in succession to perform specific tasks. These elements are data elements, also called instance variables, and functions, also called methods, of the object. Objects are defined by creating "classes," which act as templates that instruct a computer how to construct an actual object. For example, a class may specify the number and type of instance variables and the steps involved in methods that define the actions of the object. An object created from a certain class is called an "instance" of that class. The class defines the operations and information initially in an instance, while the current state of the instance is defined by operations subsequently performed upon its instance variables by its methods.
The state of an object is represented by the values of its instance variables. The state can be retrieved or updated with accessor methods. Other methods will perform operations associated with an object and may invoke additional methods on the same or other objects.
A basic feature of object-oriented programming is encapsulation of objects. "Encapsulation" means that objects hide (encapsulate) their internal structure and the algorithms that implement their actions. Instead of exposing these implementation details, objects present interfaces that represent their abstractions cleanly with no extraneous implementation information.
Because objects are encapsulated, interactions between objects occur by sending messages that invoke methods. Each object has a protocol, that is, it has a set of messages to which the object can respond. The messages are used to invoke the methods defined for the object. Typical messages are from one object to another object or from an object to itself, but an external source such as a user interface might also send messages to, or receive messages from, an object.
In properly encapsulated objects, instance variables are only accessed by methods specified for access to each instance variable. These methods are called accessor methods. Thus, an instance variable is only accessed directly by its get and put accessor methods.
Systems using object-oriented programming concepts are being developed in distributed computing environments. In these environments, active objects may be accessed by multiple users as they participate in multiple business applications. As these systems become larger, integrate more applications, and have more users, some individual objects will be the subject of frequent accesses by multiple, concurrent transactions.
As an object is updated, temporary inconsistencies may occur within a system. Locking is used to achieve exclusive use of various objects and to force an interleaving of transactions such that the results are the same as if the transactions occurred serially, one after another, rather than concurrently (serialization). Existing systems typically achieve this consistency by locking entire objects such that a competing transaction cannot access a locked object until the lock is removed, either by a commit or by a backout from the lock-holding transaction. If shared objects are used in many applications by many users, then this existing locking mechanism can significantly degrade the performance and throughput of the system.